<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* setinterval */
        var num = 10;
        var id = setInterval(() => {
            num--;
            console.log(num)
            // console.log("hello")
            // console.log(id);
            if(num==6){
                clearInterval(id)
            }
        }, 1000);
        /* 清除定时器 */
    </script>
</body>
</html>